-
Notifications
You must be signed in to change notification settings - Fork 7.1k
feat: YOLO Mode - Skip All Permission Prompts (CLI + Desktop) #9073
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
Non-network errors seen in logs: - AI_APICallError (402 deactivated_workspace) - AI_APICallError (500 server_error) - AI_LoadAPIKeyError / OpenAI API key is missing - ProviderInitError - ConfigInvalidError - ProviderAuthOauthCallbackFailed - NotFoundError - EditBuffer is destroyed
- Add getUsage() to fetch OAuth account status and health - Add fetchAnthropicUsage() to fetch Claude Max rate limits from Anthropic API - Add GET /auth/usage endpoint to expose usage data
- Add DialogAuthUsage component with rate limit visualization - Display Anthropic 5-hour and 7-day limits with progress bars - Show OAuth account status, cooldown state, and request counts - Add button in sidebar to open the dialog
- Add AuthUsageCommand to display rate limit info in terminal - Show account status, cooldown state, and request counts - Display Anthropic rate limits when available
The AI SDK's convertToModelMessages() does not accept 'step-start' as a valid UIMessagePart type. This caused AI_InvalidPromptError during session compaction. - Remove step-start from being added to UIMessage parts - Simplify the filter since step-start is no longer included - Fixes compaction breaking sessions with context overflow
## Summary Implements comprehensive multi-account OAuth support with automatic rate limit rotation, manual account switching, and a new Settings menu for the desktop app. ## Features ### Multi-Account OAuth Rotation (Backend) - Add `Auth.OAuthPool.setActive()` to manually switch active OAuth account - Add `Auth.OAuthPool.snapshot()` returns `activeID` for credential selection - Update `rotating-fetch.ts` to prefer `activeID` while keeping auto-rotation - Update `fetchAnthropicUsage()` to respect `provider.active[namespace]` - Update `getAccounts()` to correctly identify active account ### API Endpoints - Add `POST /auth/active` endpoint to switch active OAuth account - Returns updated `anthropicUsage` for immediate UI updates ### Desktop App - Settings Menu - New `DialogSettings` component with tabbed interface - **Providers Tab**: View connected providers, add new providers with search - **Provider Detail View**: Account list, usage stats, switch functionality - **About Tab**: GitHub, docs, Discord links, keyboard shortcuts - Inline provider search without leaving settings context ### Desktop App - Context Panel - Add Anthropic Rate Limits section in session context panel - Shows 5-hour, weekly (all models), weekly (sonnet) usage bars - Account switch buttons when multiple accounts configured - Only visible when current session uses Anthropic provider ### CLI Enhancements - `opencode auth usage`: Shows individual usage per OAuth account - `opencode auth switch`: Interactive command to switch active account - `opencode auth list`: Shows account count per provider - All provider lists now sorted alphabetically ## Technical Details ### Files Changed - `packages/opencode/src/auth/index.ts`: Core OAuth pool functions - `packages/opencode/src/auth/rotating-fetch.ts`: Credential selection - `packages/opencode/src/server/server.ts`: API endpoint - `packages/opencode/src/cli/cmd/auth.ts`: CLI commands - `packages/app/src/components/dialog-settings.tsx`: New settings UI - `packages/app/src/components/session/session-context-tab.tsx`: Context panel - `packages/app/src/pages/layout.tsx`: Settings button integration ### Auto-Rotation Flow 1. Request uses `activeID` (manually selected or first available) 2. On 429 rate limit → account gets cooldown, moved to back 3. Next request automatically uses next available account 4. Manual switch via UI/CLI updates `provider.active[namespace]` ### Anthropic Usage Stats Currently only Anthropic provides OAuth usage statistics. Other providers show multi-account switching but no usage bars. Contributions welcome for additional provider support.
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potential duplicate: PR #7137: feat: add --dangerously-skip-permissions flag This PR appears to be directly related as it implements a Note: PR #6968 mentions "Autonomous Mode" in the documentation context but appears less directly related to the implementation. |
|
Thanks for flagging PR #7137! Comparison of the two implementations:
Summary:
If PR #7137's simpler approach is preferred, the maintainers could merge that instead. However, this PR provides a more complete solution that addresses all related feature requests (#8463, #7928, #1813) with full parity between CLI and Desktop. Happy to consolidate or adjust based on maintainer feedback! |
|
This is such a needed addition IMO, thanks for pushing it! |
|
Update: This feature has been moved to PR #9069 (Multi-Account OAuth) where it logically belongs. See my comment below for details. |
imo not the scope of this pr, should be a different one |
- Add Auth.OAuthPool.removeRecord() to remove individual OAuth accounts - Add DELETE /auth/account API endpoint for Desktop app - Update CLI 'opencode auth logout' to select specific accounts - Add delete button with confirmation in Desktop Provider settings
000d521 to
96e2bab
Compare
|
Good catch @iljod! You're absolutely right - the delete account functionality doesn't belong in this PR. I've moved it to PR #9069 (Multi-Account OAuth) where it logically belongs. The delete feature is needed for managing multiple OAuth accounts, not for YOLO mode. Changes made:
This PR now focuses purely on YOLO mode functionality. |
Implements comprehensive YOLO mode for both CLI and Desktop: CLI: - --yolo / --dangerously-skip-permissions flag - OPENCODE_YOLO environment variable - 'opencode yolo status/enable/disable' commands Desktop: - Settings → Danger Zone tab with clear UI - Session-only toggle (resets on restart) - Permanent toggle (saves to ~/.config/opencode/config.json) - Live switching without app restart Config: - 'yolo: true' in opencode.json or global config Technical: - Yolo module manages state across CLI and server - PermissionNext.ask() auto-approves when YOLO is enabled - Explicit deny rules still respected - API endpoints GET/POST /config/yolo for runtime control Closes anomalyco#9070 Related: anomalyco#8463, anomalyco#7928, anomalyco#1813
96e2bab to
8a79f4f
Compare
Summary
Comprehensive implementation of YOLO mode that allows users to skip all permission prompts. This addresses multiple community requests (#8463, #7928, #1813) with a complete solution for both CLI and Desktop.
Closes #9070
Features
CLI Support
opencode --yolooropencode --dangerously-skip-permissionsOPENCODE_YOLO=true opencodeopencode yolo status/enable/disableDesktop App Support
New Settings → Danger Zone tab with:
~/.config/opencode/config.jsonConfig File Support
{ "yolo": true }Works in both project-level
opencode.jsonand global~/.config/opencode/config.json.Technical Implementation
packages/opencode/src/yolo/index.ts): Centralized state managementpermission/next.ts): Auto-approves inPermissionNext.ask()when YOLO enabledGET/POST /config/yolofor runtime controldenyrules are still respected even in YOLO modeFiles Changed
packages/opencode/src/yolo/index.tspackages/opencode/src/cli/cmd/yolo.tspackages/opencode/src/permission/next.tspackages/opencode/src/server/routes/config.tspackages/opencode/src/flag/flag.tspackages/opencode/src/config/config.tspackages/opencode/src/index.tspackages/app/src/components/dialog-settings.tsxTesting
Manually tested:
--yoloflagopencode yolocommandsRelated Issues
This PR provides a comprehensive solution that addresses:
--dangerously-skip-permissions(aka YOLO mode) #8463:--dangerously-skip-permissionsflag ✅